<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
   
    </style>
</head>
<body>
    <div id="app">        
        <img v-on:click="clickHandle" />
        <book v-on:myclick="fn01"></book>
    </div>
</body>
</html>
<script src="./js/vue.js"></script>
<script>

    // 书籍详情：
    let book = {
        props:{          
            "name":{
                type:String,
                default:"西游记"
            },
            "price":Number
        },
        template:`
            <div>
                <p>名字：{{name}}</p>
                <p>价格：{{price}}</p>
                <p @mouseenter="enterHandle" >触发myclick事件</p>
            </div>
        `,        
        data(){
            return { }
        },
        methods:{
            enterHandle(){
                // this.$emit("自定义事件名"，若干个参数);用来触发事件。
                this.$emit("myclick","hi");
            }
        }
    }   


    let vm = new Vue({
        el:"#app",
        components:{
            book
        },
        methods:{
            fn01(str){
                console.log("fn01",str);
            },
            clickHandle(e){
                console.log("e",e);
            }
        }        
    });


</script>